package model01;

import java.io.IOException;

public class KeyboardInput {
	public static void main(String[] args) {
		//tao mang kieu byte gom 10 phan tu
		byte[] data;
		
		try {
			data = new byte[20];
			
			System.out.print("Hay nhap vao vai ki tu: ");
			System.in.read(data);
			
			//xuat du lieu tu mang ra man hinh
			System.out.print("Ban vua nhap: ");
			for(int i = 0; i < data.length; i++) {
				System.out.print((char)data[i] + "  ");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * Chuong trinh se xuat ra ma nhi phan nhu duoi day neu khong ep kieu
	 * null: 				13  10  0  0  0  0  0  0  0  0 //13 10 la ma hoa cua phim enter khi ta ko nhap j ma enter
	 * a: 					97  13  10  0  0  0  0  0  0  0 
	 * abc: 				97  98  99  13  10  0  0  0  0  0  
	 * abcdef123456789: 	97  98  99  49  50  51  52  53  54  55 
	 * abc 123: 			97  98  99  32  49  50  51  13  10  0
	 */
	/*
	 * Khi doc chuoi nhap vao thi chuong trinh se doc theo tung byte mot cho den khi het chuoi
	 * Vi vay khi xuat ra man hinh thi ta chung xuat theo tung byte nen ta phai dung vong for de duyet
	 * tung phan tu trong mang byte
	 */
	
}
